<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outter .inner {
            color: red;
        }

        .outter.inner {
            color: aqua;
        }
        
        div {
            color: aquamarine;
        }
    </style>
</head>

<body>

    <div class="outter">
        <div class="outter inner">
            hello
        </div>
    </div>
    <script>
        function Pagination(container, total, current) {
            this.total = total;
            this.current = current;
            this.html = html;
            this.val = val;
            this.el = document.querySelector("#container");
            if (!this.el) return;

            this.el.innerHTML = this.html();
            container.appendChild(this.el);
            this.el.className = this.html() == '' ? 'pagination.hide' : 'pagination';

            function html() {
                if (this.total <= 1) return '';

                let liList = ``
                if (total > 5 && current > 3) liList += `<li>首页</li>`
                for (let i = current - 2; i <= current + 2; i++) {
                    liList += `<li>${i}</li>`
                }
                if (total > 5) liList += `<li>末页</li>`

                let html = `
            <div>(Demo1) total: ${total}，current: ${current}</div>
            <ul class="pagination">
                ${liList}
            </ul>
        `

                return html;
            }

            function val(current) {
                if (arguments.length === 0) return this.current;
                if (current < 1 || current > this.total || current === this.current) return;
                this.current = current;
                this.el.innerHTML = this.html();
            };
        }
    </script>

    <script>
        function resolve(fooClassNum, maxFeel, fooFeelArr) {
            let maxCount = maxFeel + 1;
            let dp = new Array(maxCount).fill(maxCount);
            dp[0] = 0;
            let path = [];
            for (let i = 0; i <= maxFeel; i++) {
                for (let j = 0; j < fooClassNum; j++) {
                    if (fooFeelArr[j] <= i) {
                        dp[i] = Math.min(dp[i - fooFeelArr[j]] + 1, dp[i]);
                        if (dp[i] == dp[i - fooFeelArr[j]] + 1) {
                            path.push(j);
                        }
                    }
                }
            }
        }

        // resolve(4, 10, [1, 2, 9, 5]);
    </script>
</body>

</html>